package com.csp.mingyue.system.controller;

import com.csp.mingyue.common.core.vo.R;
import com.csp.mingyue.common.satoken.utils.LoginHelper;
import com.csp.mingyue.system.api.vo.RouterVo;
import com.csp.mingyue.system.service.SysMenuService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 菜单权限表 前端控制器
 * </p>
 *
 * @author Strive
 * @since 2023-07-21 10:36:37
 */
@Tag(name = "菜单管理模块")
@RestController
@RequestMapping("/sysMenu")
@RequiredArgsConstructor
public class SysMenuController {

	private final SysMenuService sysMenuService;

	/**
	 * 获取路由信息
	 * @return 路由信息
	 */
	@GetMapping("getRouters")
	@Operation(summary = "获取路由信息")
	public R<List<RouterVo>> getRouters() {
		Long userId = LoginHelper.getLoginUser().getUserId();
		return R.ok(sysMenuService.getRouters(userId));
	}

}
